package com.igeek.d0603;

import javax.xml.transform.sax.SAXTransformerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @Author: zhiyu
 * @Date:18:48
 * @DESC:
 */
public class MapDemo {
    public static void main(String[] args) {
        System.out.println("请输入一个字符串:");
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        count(input);
    }
    public static void count(String input){
        char[] arr = input.toCharArray();
        HashMap<Character, Integer> map = new HashMap<>();
        for (char c:arr) {
            map.put(c,!map.containsKey(c)?1:map.get(c)+1);
        }
        for (Character key:map.keySet()) {
            System.out.println(key+"="+map.get(key));
        }
    }
}
